package csci5828.servlet;

import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

import org.apache.log4j.Logger;

import csci5828.search.SearchResults;
import csci5828.tasks.impl.TaskManagerImpl;

public class ApplicationLifecycleListener implements ServletContextListener {
	
	private final Logger logger = Logger.getLogger(getClass());

	@Override
	public void contextDestroyed(ServletContextEvent ev) {
		logger.info(ev);
	}

	@Override
	public void contextInitialized(ServletContextEvent ev) {
		logger.info(ev);
		ServletContext ctxt = ev.getServletContext();
		ctxt.setAttribute(ContextAttributes.SEARCH_TASK_MANAGER, new TaskManagerImpl<SearchResults>());
	}
}
